package com.feihong.yw189.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.KeyEvent;

import com.feihong.yw189.activity.denglu.DengLuActivity;
import com.feihong.yw189.activity.shouye.MainActivity;
import com.feihong.yw189.utils.UserLoginInfo;

/**
 * @author wangziheng
 * @name Android
 * @class name：com.feihong.yw189.activity
 * @class describe:
 * @time 2018/2/7 15:25
 * @change
 * @chang time
 * @class describe
 */
public class WelcomActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
            finish();
            return;
        }
        Intent intent = new Intent();
        if(TextUtils.isEmpty(UserLoginInfo.getUserLoginInfoInstance().getUserToken())){
            intent.setClass(this,DengLuActivity.class);
        }else {
            intent.setClass(this,MainActivity.class);
        }
        startActivity(intent);
        finish();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
